package no.spk.demo.tcalc.domain;

public class CClass {
    private String name;
    private int hp;
    private int arm;   
    private int plusDef;
    private double dod;
    private double par;
    
    /**
     * @see http://evilempireguild.org/guides/diminishmath.php
     * @return
     */
    public double getMit(){
        return (arm / (arm + 467.5 * 83 - 22167.5)) * 100;
    }
    
    public double getEH(){
        return ( 1 / ( (1 - getMit()/100) / hp ) );
    }

    public double getMiss() {
        return ((400+plusDef) - 83*5)*0.04 + 5;
    }

    public double getAvoid(){
        return getMiss() + getDod() + getPar();
    }
    
    /**
     * @see http://maintankadin.failsafedesign.com/forum/index.php?p=462841&rb_v=viewtopic
     * @return
     */
    public double getDPRatio(){
        if( ( getPar() - 10.0 ) <= 0 )
            return 0;
        
        if( ( getDod() - 10.0 ) <= 0 )
            return getDod() / getPar();
        
        return (getDod() - 10.0 ) / (getPar() - 10.0);
    }
    
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getHp() {
        return hp;
    }

    public void setHp(int hp) {
        this.hp = hp;
    }

    public int getArm() {
        return arm;
    }

    public void setArm(int arm) {
        this.arm = arm;
    }

    public int getPlusDef() {
        return plusDef;
    }

    public void setPlusDef(int plusDef) {
        this.plusDef = plusDef;
    }    

    public double getDod() {
        return dod;
    }

    public void setDod(double dod) {
        this.dod = dod;
    }

    public double getPar() {
        return par;
    }

    public void setPar(double par) {
        this.par = par;
    }
}
